﻿@{
    ViewBag.Title = "Common Command";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
       <ol class="breadcrumb">
    <li><a href="/Home.html">Home</a></li>
    <li><a href="/WebApp/WebApi"> Sanelib WebApp</a></li>
    <li class="active">Recorder</li>
</ol>
      
            
            <div id="introduction">
                <h1 class="text-left">ControllerApis</h1>
                <h4>RecorderController</h4>
            </div>
            <div>
                <h3>Class Inherited : SmartApiController</h3>
                <table class="table-condensed table-striped">
                    <tr>
                        <th>Constructor</th>
                        <th>Parameters</th>
                    </tr>
                    <tr>
                        <td class="table-bordered">IUserSession</td>
                        <td class="table-bordered">IMapingEngine</td>
                    </tr>
                </table>
                <p>Where, Parameters Local Variable are assigned to a Instance Variable form the <b>base</b> of <a href="/WebApp/SmartApi" class="btn-link">SmartApiController</a></p>
                <ol id="method">
                    <li>
                        <p><b>Post() :</b> in this method describe the current user process</p>
                        <pre><code>
public HttpResponseMessage Post()
{
    var proc = Process.GetCurrentProcess();
    EventCoordinator.Raise(new HealthDataAdded("Physical Memory", proc.PrivateMemorySize64.ToString(CultureInfo.InvariantCulture)));
    EventCoordinator.Raise(new HealthDataAdded("Virtual Memory", proc.VirtualMemorySize64.ToString(CultureInfo.InvariantCulture)));
    EventCoordinator.Raise(new HealthDataAdded("Non Paged System Memory", proc.NonpagedSystemMemorySize64.ToString(CultureInfo.InvariantCulture)));
    EventCoordinator.Raise(new HealthDataAdded("Paged System Memory", proc.PagedSystemMemorySize64.ToString(CultureInfo.InvariantCulture)));
    EventCoordinator.Raise(new HealthDataAdded("Peak Paged Memory", proc.PeakPagedMemorySize64.ToString(CultureInfo.InvariantCulture)));
    EventCoordinator.Raise(new HealthDataAdded("Peak Virtual Memory", proc.PeakVirtualMemorySize64.ToString(CultureInfo.InvariantCulture)));
    var response = new WebApiResultResponse();
    return Content(response.Message = "All events are raised and health recorded");
}
</code></pre>
                        <p>here, the Process is the derived form the <b>"System.Dignostics.Process"</b>"" and GetCurrentProcess() is get the current user process and the </p>
                        <p><b>EventCoordinator</b> is the Core Class where to defined to the <b>Raise</b> Mehod with the parameter of the TEvent generics where the condition is to the <b>where TEvent : IEvent</b></p>
                        <p> at the last <b>WebApiResultResponse</b> is the defined in the Sanelib Library for the WebApiRequest and Response</p>
                        <p>and the return the content of the response into the <a href="/WebApp/SmartApi" class="btn-link">SmartApiController</a></p>

                    </li>

                </ol>
            </div>
       